Spread.Services allows users to create and delete chart in spreadsheets as per their requirements.
You can create and delete chart using the properties and methods of the IShapes Interface and the IChart interface
You can create chart in a worksheet by using the AddChart method of the IShapes interface.
Refer to the following example code to create a chart.
C# |
Copy Code |
---|---|
//Add Chart IShape shape = worksheet.Shapes.AddChart(ChartType.ColumnClustered, 200, 100, 300, 300); worksheet.Range["A1:D6"].Value = new object[,] { {null, "Revenue", "Profit", "Sales"}, {"North", 10, 25, 25}, {"East", 51, 36, 27}, {"South", 52, 85, 30}, {"West", 22, 65, 65} }; |
You can delete an existing chart by using Delete method of the IChart interface.
Refer to the following example code to delete a chart from your spreadsheet.
C# |
Copy Code |
---|---|
// Delete Chart
shape.Chart.Delete(); |